import {createBrowserRouter} from "react-router-dom";
import Layout from "@/pages/Layout";
import Login from "@/pages/Login";
import {lazy, Suspense} from "react";

const Home = lazy(()=>import('@/pages/Home'))
const Aritcle = lazy(()=>import('@/pages/Aritcle'))
const Publish = lazy(()=>import('@/pages/Publish'))

const router = createBrowserRouter([
    {
        path:"/",
        element:<Layout/>,
        children:[
            {
                index:true,
                element: <Suspense fallback={'加载中'}><Home/></Suspense>
            },
            {
                path:'article',
                element:<Suspense fallback={'加载中'}><Aritcle/></Suspense>
    },
            {
                path:'publish',
                element:<Suspense fallback={'加载中'}><Publish/></Suspense>
}
        ]
    },
    {
        path:"/login",
        element:<Login/>
    }
])
export default router